package com.example.game.controller;

import com.example.game.service.Impl.GameServiceImpl;
import com.pojo.Entity.Game;
import com.pojo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("game")
public class GameController extends  BaseController{
    @Autowired
    private GameServiceImpl gameService;
    @PostMapping("/insert")
    public Result<?>insert(Game game, HttpServletRequest httpServletRequest){
        return gameService.insert(game,httpServletRequest)==1?Result.success():Result.failure();
    }
    @PostMapping("update")
    public Result<?>update(Game game, HttpServletRequest httpServletRequest){
        return gameService.update(game,httpServletRequest)==1?Result.success():Result.failure();
    }
    @PostMapping("getlgame")
    public Result<?>getlgame(Integer Page,Integer Number){
        return Result.success( gameService.getlGame(Page,Number));
    }
    @PostMapping("getgame")
    public Result<?>getgame(Integer gID){
        return Result.success(gameService.getGame(gID));
    }

}
